|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
/**
|
|
|
|
|
* This file provides the paths to the pages
|
|
|
|
|
*/
|
|
|
|
|
import {getWindowUrl} from './utils';
|
|
|
|
|
import {getWindowUrl, displayRef} from './utils';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const CREATE_ELECTION = '/admin/new/';
|
|
|
|
@ -10,19 +10,20 @@ export const ENDED_VOTE = '/ballot/end';
|
|
|
|
|
export const VOTE = '/vote/';
|
|
|
|
|
export const RESULTS = '/result/';
|
|
|
|
|
|
|
|
|
|
export const getUrlVote = (electionId: string | number, token?: string): URL => {
|
|
|
|
|
export const getUrlVote = (electionRef: string | number, token?: string): URL => {
|
|
|
|
|
const origin = getWindowUrl();
|
|
|
|
|
if (token)
|
|
|
|
|
return new URL(`/${VOTE}/${electionId}/${token}`, origin);
|
|
|
|
|
return new URL(`/${VOTE}/${electionId}`, origin);
|
|
|
|
|
return new URL(`/${VOTE}/${displayRef(electionRef)}/${token}`, origin);
|
|
|
|
|
return new URL(`/${VOTE}/${displayRef(electionRef)}`, origin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getUrlResults = (electionId: string | number): URL => {
|
|
|
|
|
export const getUrlResults = (electionRef: string | number): URL => {
|
|
|
|
|
const origin = getWindowUrl();
|
|
|
|
|
return new URL(`/${RESULTS}/${electionId}`, origin);
|
|
|
|
|
return new URL(`/${RESULTS}/${displayRef(electionRef)}`, origin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getUrlAdmin = (electionId: string | number, adminToken: string): URL => {
|
|
|
|
|
export const getUrlAdmin = (electionRef: string | number, adminToken: string): URL => {
|
|
|
|
|
const origin = getWindowUrl();
|
|
|
|
|
return new URL(`/admin/${electionId}?t=${adminToken}`, origin);
|
|
|
|
|
return new URL(`/admin/${displayRef(electionRef)}/${adminToken}`, origin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|